package com.pai4j.message.builder.interaction;

import com.pai4j.common.constants.MessageConstants;
import com.pai4j.common.enums.InteractionMessageTypeEnum;
import com.pai4j.domain.vo.dto.FocusMessageDTO;
import com.pai4j.message.core.builder.AbstractMessageBuilder;
import lombok.extern.slf4j.Slf4j;

/**
 * 关注消息构建器
 * 用于构建关注互动消息
 *
 * @author PAI4J Team
 * @date 2025-11-01
 */
@Slf4j
public class FollowMessageBuilder extends AbstractMessageBuilder<FocusMessageDTO> {

    public FollowMessageBuilder() {
        super();
        context.setMessageTypeEnum(InteractionMessageTypeEnum.FOLLOW);
        context.setType(MessageConstants.TypeEnum.FOCUS.getType());
        context.setCategory(MessageConstants.CategoryEnum.FOCUS.getCategory());
    }

    @Override
    protected String getMessageCategory() {
        return MessageConstants.CategoryEnum.FOCUS.getCategory();
    }

    @Override
    protected FocusMessageDTO createMessageDTO() {
        return new FocusMessageDTO();
    }

    @Override
    protected void fillMessageDTO(FocusMessageDTO messageDTO) {
        // 如果内容为空，使用默认文本
        if (messageDTO.getContent() == null) {
            messageDTO.setContent("关注了你");
        }
    }

    @Override
    protected String[] getTemplateVarNames() {
        return new String[]{"userName"};
    }

    /**
     * 快速构建关注消息
     */
    public static FollowMessageBuilder create() {
        return new FollowMessageBuilder();
    }
}

